<?php
class shopRecommend extends logCAr
{




	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}
	
	/* reset db */
	public function getDbConnection()
	{
		self::$db=Yii::app()->db1;
		if(self::$db instanceof CDbConnection) return self::$db;
	}


	
    public function tableName()
	{
		return '{{act_recommend}}';
	}
    /* rules */
    public function rules()
    {
        return array(
            array('id,is_good,title', 'safe', 'on'=>'search'),
        );
    }

    public function search()
    {
        $criteria=new CDbCriteria;
        $criteria->compare('del_flag',0);
        if ($this->is_good) {
            $criteria->compare("is_good",$this->is_good-1);
        }
        $criteria->compare('title',$this->title,true);
        return new CActiveDataProvider($this, array(
            'criteria'=>$criteria,
        ));
    }

}